package Temp.foundation;

import java.util.Arrays;

public class 冒泡排序 {
    public static void main(String[] args) {
        int arr[] = {5, 6, 7, 2, 3, 4, 1, 9, 8};

        for (int j = 0; j < arr.length; j++) {
            for (int i = 0; i < arr.length - 1 - 1; i++) {
                if (arr[i] > arr[i + 1]) {
                    int temp = arr[i];
                    arr[i] = arr[i + 1];
                    arr[i + 1] = temp;
                }
                //System.out.println(Arrays.toString(arr));
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
